<!doctype html>
<html>

	<head>
		<meta charset="UTF-8">
		<title></title>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<link href="../css/mui.min.css" rel="stylesheet" />
		<link rel="stylesheet" type="text/css" href="../css/app.css" />
		<link rel="stylesheet" type="text/css" href="css/login.css" />
		<link rel="stylesheet" type="text/css" href="css/register.css" />
		<link rel="stylesheet" type="text/css" href="../css/iconfont.css" />
		<link href="../css/mui.picker.min.css" rel="stylesheet" />
		<link href="../css/mui.poppicker.css" rel="stylesheet" />
		<style>
			.logininfo {
				background-color: #FFFFFF;
				border-radius: 5px;
				margin: 20px 20px 0px 20px;
				padding: 20px 20px 20px 20px;
			}
			
			.mui-input-row span {
				display: block;
				width: 15%;
			}
			
			.iconfont {
				font-size: 1.5rem;
				vertical-align: middle;
				color: #444444;
			}
			
			.mui-input-row textarea {
				border: 0;
			}
		</style>
	</head>

	<body>
		<header class="mui-bar mui-bar-nav">
			<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left backbtn"></a>
			<h1 class="mui-title">工作信息</h1>
			<a class=" mui-pull-right homebtn">资质</a>
		</header>
		<div class="mui-content">
			<div class="logininfo">
				<div class="mui-input-row">
					<label class=" "></label>
					<input id='comName' type="text" class=" mui-input" placeholder="单位名称">
				</div>
				<div class="mui-input-row">
					<label class=" "></label>
					<input id='comPhone' type="text" class=" mui-input" placeholder="单位电话">
				</div>
				<div class="mui-input-row" id='showUserPicker'>
					<label></label>
					<input type="text" id="workAddress" class=" mui-input" placeholder="省市区">
				</div>
				
				
				
			</div>
			<div class="btn">
				<button type="button" class="mui-btn mui-btn-yellow mui-btn-block workaddressSub">保存</button>
			</div>
		</div>
		<script src="../lib/mui.min.js"></script>
		<script src="../lib/mui.picker.min.js"></script>
		<script src="../lib/mui.poppicker.js"></script>
		<script src="../lib/city.data.js"></script>
		<script src="../lib/city.data-3.js"></script>
		<script type="text/javascript" src="../lib/jquery-1.11.0.js"></script>
		<script type="text/javascript" src="../lib/service.js"></script>

		<script type="text/javascript">
			mui.init()
			mui.plusReady(function() {
				plus.navigator.setStatusBarBackground("#FF7234");

				var setcity = new mui.PopPicker({
					layer: 3
				});
				setcity.setData(cityData3);
				$('#showUserPicker').bind('tap', function(event) {
					setcity.show(function(items) {
						console.log(items)
						$('#workAddress').val(items[0].text + "-" + items[1].text + "-" + items[2].text)
					})
				})
				//初始化数据
//				getServer('app/member/addressList', "", function(res) {
//					console.log(JSON.stringify(res))
//					//				console.log(res.data.code)
//					if(res.data != null){
//						$('#address').val(res.data.address)
//						$('#city').val(res.data.city)
//						$('#phone').val(res.data.phone)
//						$('#truename').val(res.data.truename)
//					}
//						
//				});
				$('.workaddressSub').bind('tap', function() {
					if($('#comName').val() ==""){
						mui.toast("工作单位不能为空")
						return;
					}
					if($('#comPhone').val() == ""){
						mui.toast("单位电话不能为空")
						return;
					}
					if($('#workAddress').val() == ""){
						mui.toast("单位地址不能为空")
						return;
					}
					var subData = {
						comName: $('#comName').val(),
						comPhone: $('#comPhone').val(),
						workAddress: $('#workAddress').val()
						 
					}
					console.log(JSON.stringify(subData))
					postServer('app/member/certifyAddress', $.param(subData), function(res) {
						console.log(JSON.stringify(res))
						mui.toast(res.message)
						plus.webview.getLaunchWebview().evalJS("activeModel()")
						plus.webview.currentWebview().close()
					});
				})
			});
			//返回资质列表
			$('.homebtn').bind('tap',function(){
				plus.webview.getWebviewById('../real-name/real-name.html').close();
				plus.webview.currentWebview().close()
			})
		</script>
	</body>

</html>